<?php


class EntryImageTable extends EntryFileTable
{

    public static function getInstance()
    {
        return Doctrine_Core::getTable('EntryImage');
    }

	public function __construct($name, Doctrine_Connection $conn, $initDefinition = false){
		$this->setAttribute(Doctrine_Core::ATTR_QUERY_CLASS, str_replace("Table", "Query", get_class($this)));
		return parent::__construct($name, $conn, $initDefinition);
	}

	public function createQueryCommons($alias = ''){
    	$q=$this->createQuery($alias);
    	$q=$this->getSortedQuery("ASC", $q); // visiem querijiem pa virsu jāliek sortable no Sortable plugina
    	return $q;
    }

    public function createQueryForBackend($alias = ''){
    	$q=$this->createQueryCommons($alias);
    	return $q;
    }

    // for DoctrineRouting
    public function retrieveListByEntryForBackendRouting($values){
    	return $this->retrieveListByEntryIdForBackend($values["entry_id"]);
    }

    public function retrieveListByEntryIdForBackend($entryId){
    	return $this->createQueryForBackend()->addWhereEntryId($entryId)->execute();
    }



}